<?php
/**
 * 商品类型属性模型
 * @author e5
 *
 */
class TypeAttrModel extends Model{
	public $table = "typeattr";
	public $validate = array(
			array("taname","nonull","属性名称不能为空",2,3),
			array("taname","maxlen:20","属性名称不能超过20个字符",2,3),
			array("tavalue","nonull","属性值不能为空",2,3),
			array("tavalue","maxlen:255","属性值不能超过255个字符",2,3)
	);
	public $auto = array(
			array("tatype","intval","function",2,3),
			array("tid","intval","function",2,3)
	);
	public $map = array(
			"tid"=>"vshop_type_tid"
	);
	/**
	 * 添加属性
	 */
	public function addTypeAttr(){
		if (!$this->create()) return false;
		return $this->add();
	}
	public function editTypeAttr(){
		if (!$this->create()) return false;
		$this->update();
		return true;
	}
}